<?php

namespace App\Service\Common;


use App\Models\Ekb\EkbBranchBankModel;

class EkbService
{

    /**
     * @param string $branchName
     * @param string $bankName
     * @return array
     */
    public static function branchBank(string $branchName, string $bankName): array
    {
        return [
            "list" => EkbBranchBankModel::query()->when(strlen(trim($branchName)) || strlen(trim($bankName)),
                function ($query) use ($branchName, $bankName) {
                    $query->where("branchName", "like", "%{$branchName}%")
                          ->where("branchName", "like", "%{$bankName}%");
                })->limit(20)->get()
        ];
    }

}
